#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <queue>
#include <numeric>
#include <map>
#include <variant>

using namespace std;

struct Node
{
    vector<int> val;
    Node* left;
    Node* right;

    Node(int x, int y) {
        val.push_back(x);
        val.push_back(y);
        left = nullptr;
        right = nullptr;
    }
};

class Solution {
    int m_tx{};
    int m_ty{};
public:
    bool reachingPoints(int sx, int sy, int tx, int ty) {
        m_tx = tx;
        m_ty = ty;
        /* 建立二叉树，在先序建树的过程中判断 */
        Node* root = nullptr;
        return BuildTree(sx, sy, root);;
    }

    bool BuildTree(int x, int y, Node* node)
    {
        if (x == m_tx && y == m_ty) {
            return true;
        }

        if (x >= max(m_tx, m_ty) || y >= max(m_tx, m_ty)) {
            return false;
        }

        Node* tmpNode = new Node(x, y);
        node = tmpNode;
        if (BuildTree(x+y, y, node->left) == true) {
            return true;
        }

        if (BuildTree(x, x+y, node->right) == true) {
            return true;
        }
        
        return false;
    }
};

int main()
{   
    Solution s;
    cout << boolalpha << s.reachingPoints(1, 1, 2, 2) << endl;
    return 0;
}